package com.tqyan.service.chat;

import com.alibaba.fastjson.JSONObject;
import com.tqyan.model.enums.NovelTypeEnum;

/**
 * 指令内容
 * <p> <功能详细描述> </p>
 *
 * @author 陈晨
 * @version 1.0
 * @date 2023/5/29
 */
public abstract class ChatPointContent {

    /**
     * 指令
     */
    public static final String DEFAULT = null;
    public static final String USER_LETTER = "至用户的一封信";
    public static final String POINT = "指令";

    public static final String PAPER = "论文";
    public static final String PAPER_COMPLETE = "完成论文";
    public static final String PAPER_CANCEL = "取消论文";
    public static final String PAPER_VIEW = "查看论文";

    public static final String NOVEL = "小说";
    public static final String NOVEL_TYPE = "小说类型";
    public static final String NOVEL_NEXT_SCENE = "下一场景";
    public static final String NOVEL_NEXT_OPTION = "下一幕";
    public static final String NOVEL_VIEW = "查看小说";
    public static final String NOVEL_SPLIT = "\n-------------\n";

    /**
     * 按钮
     */
    public static final String BTN_AUTO_TRUE = "{\"text\":\"%s\", \"auto\":\"true\", \"value\":\"%s\"}";
    public static final String BTN_AUTO_FALSE = "{\"text\":\"%s\", \"auto\":\"false\", \"value\":\"%s\"}";
//    public static final String BTN_1003 = "<text class=\"item showUrl\">%s</text>";

    /**
     * 文本
     */
    public static final String ANSWER_1000 = generateButtonResult(
            "您可以直接输入内容与AI对话，也可以使用以下指令："
            , new String[]{
                    String.format(BTN_AUTO_FALSE, PAPER + "：", "写论文，输入标题")
                    , String.format(BTN_AUTO_TRUE, PAPER_VIEW, "查看论文")
//                    , String.format(BTN_AUTO_TRUE, PAPER_CANCEL, "取消撰写中的论文")
                    , String.format(BTN_AUTO_FALSE, NOVEL + "：", "写小说，输入标题")
                    , String.format(BTN_AUTO_TRUE, NOVEL_VIEW, "查看小说")
            });

    /**
     * 论文
     */
    public static final String ANSWER_1001 = generateButtonResult(
            "论文《%s》撰写中，约需20分钟"
            , new String[]{
                    String.format(BTN_AUTO_TRUE, PAPER_VIEW, "查看撰写进度")
            });
    public static final String ANSWER_1002 = generateButtonResult(
            "论文《%s》正在撰写中"
            , new String[]{
                    String.format(BTN_AUTO_TRUE, PAPER_VIEW, "查看撰写进度")
            });
    public static final String ANSWER_1003 = generateButtonResult(
            "论文《%s》正在进行中，可通过以下指令进行操作："
            , new String[]{
                    String.format(BTN_AUTO_TRUE, PAPER_COMPLETE, "完成撰写")
                    , String.format(BTN_AUTO_TRUE, PAPER_CANCEL, "取消论文")
            });
    public static final String ANSWER_1004 = generateButtonResult(
            "%s"
            , new String[]{
                    String.format(BTN_AUTO_TRUE, PAPER_COMPLETE, "完成撰写")
                    , String.format(BTN_AUTO_TRUE, PAPER_CANCEL, "取消论文")
            });
    public static final String ANSWER_1005 = "以下是您已完成的论文，点击查看完整内容: ";

    /**
     * 小说
     */
    public static final String ANSWER_1006 = generateButtonResult(
            "您正在撰写《%s》，请选择小说的类型："
            , new String[]{
                    String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.LOVE.getDesc()
                            , NovelTypeEnum.LOVE.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.MARTIAL_ARTS.getDesc()
                            , NovelTypeEnum.MARTIAL_ARTS.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.INFERENCE.getDesc()
                            , NovelTypeEnum.INFERENCE.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.SCIENCE_FICTION.getDesc()
                            , NovelTypeEnum.SCIENCE_FICTION.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.HISTORY.getDesc()
                            , NovelTypeEnum.HISTORY.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.SOCIETY.getDesc()
                            , NovelTypeEnum.SOCIETY.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.ADVENTURE.getDesc()
                            , NovelTypeEnum.ADVENTURE.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.MAGIC.getDesc()
                            , NovelTypeEnum.MAGIC.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.FAIRY_TALES.getDesc()
                            , NovelTypeEnum.FAIRY_TALES.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.SUSPENSE.getDesc()
                            , NovelTypeEnum.SUSPENSE.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.TERROR.getDesc()
                            , NovelTypeEnum.TERROR.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.WAR.getDesc()
                            , NovelTypeEnum.WAR.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.XIAN_XIA.getDesc()
                            , NovelTypeEnum.XIAN_XIA.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.SPORTS.getDesc()
                            , NovelTypeEnum.SPORTS.getDesc())
                    , String.format(BTN_AUTO_TRUE, NOVEL_TYPE + ":%s_" + NovelTypeEnum.PASS_THROUGH.getDesc()
                            , NovelTypeEnum.PASS_THROUGH.getDesc())
            });
    public static final String ANSWER_1007 = "以下是您撰写的小说，点击查看完整内容: ";
    public static final String ANSWER_1008 = generateButtonResult(
            "您还没有开始撰写《%s》，可通过以下指令进行操作："
            , new String[]{
                    String.format(BTN_AUTO_TRUE, NOVEL + ":%s", "开始撰写")
            });
    public static final String ANSWER_1009 = generateButtonResult(
            "您还没有撰写小说，可通过以下指令进行操作："
            , new String[]{
                    String.format(BTN_AUTO_FALSE, NOVEL + ":", "开始撰写，输入标题")
            });
    public static final String ANSWER_1010 = generateButtonResult(
            "%s"
            , new String[]{
                    String.format(BTN_AUTO_TRUE, NOVEL_NEXT_OPTION + ":%s", NOVEL_NEXT_OPTION)
            });

    /**
     * @description 生成文件结果
     * <p> <功能详细描述> </p>
     *
     * @author 陈晨
     * @date 2023/5/29 17:21
     */
    public static String generateFileResult(String content, String fileName, String fileUrl) {
        JSONObject resultJson;
        try {
            resultJson = JSONObject.parseObject(content);
        } catch (Exception e) {
            resultJson = new JSONObject();
            resultJson.put("content", content);
        }
        resultJson.put("fileName", "《" + fileName + "》");
        resultJson.put("fileUrl", fileUrl);
        resultJson.put("fileSize", "10KB");
        resultJson.put("fileType", "docx");
        return resultJson.toJSONString();
    }

    /**
     * @description 生成按钮结果
     * <p> <功能详细描述> </p>
     *
     * @author 陈晨
     * @date 2023/5/29 17:21
     */
    public static String generateButtonResult(String content, String[] buttons) {
        JSONObject resultJson;
        try {
            resultJson = JSONObject.parseObject(content);
        } catch (Exception e) {
            resultJson = new JSONObject();
            resultJson.put("content", content);
        }
        resultJson.put("buttons", buttons);
        return resultJson.toJSONString();
    }

    public static void main(String[] args) {
        System.out.println(ANSWER_1006);
        System.out.println(ANSWER_1007);
        System.out.println(ANSWER_1008);
        System.out.println(ANSWER_1009);
        System.out.println(ANSWER_1010);
    }

}


